<div id="header">
	<div id="topnav">
	<%if CheckLogin() then%>
		您好, <label id="user"><a id="changepws" href="#"><%=session("sFullName")%></a></label>
		<a id="logout" href="#">退出</a>
	<%else%>
		<a id="login" href="#">登录</a>
	<%end if%>
	</div>
	<h1>宁波数字电视自建工作支撑系统</h1>
</div>
<div id="dv_changepws" title="修改密码">
	<form id="fm_changepws" method="post" class="yform full" role="application">
		<div class="type-text">
			<label for="old_password">原密码*</label>
			<input name="old_password" id="old_password" type="password" maxlength="10" class="validate[required,minSize[6],maxSize[10]]" />
		</div>
		<div class="type-text">
			<label for="new_password">新密码*</label>
			<input name="new_password" id="new_password" type="password" maxlength="10" class="validate[required,minSize[6],maxSize[10],custom[onlyPassword]]" />
		</div>
		<div class="type-text">
			<label for="confirm_password">确认密码*</label>
			<input name="confirm_password" id="confirm_password" type="password" maxlength="10" class="validate[required,minSize[6],maxSize[10],custom[onlyPassword]]" />
		</div>
	</form>
</div>
<div id="dv_login" title="登录界面">
	<form id="fm_login" method="post" class="yform full" role="application">
		<div class="type-text">
			<label for="login_username">用户名*</label>
			<input name="login_username" id="login_username" type="text" maxlength="10" class="validate[required,minSize[3],maxSize[10]]" />
		</div>
		<div class="type-text">
			<label for="login_password">密码*</label>
			<input name="login_password" id="login_password" type="password" maxlength="10" class="validate[required,minSize[6],maxSize[10]]" />
		</div>
	</form>
</div>
<script type="text/javascript">
  $(function() {
    $("#login").click(function(){
      $("#dv_login").dialog("open");
    });
    $("#changepws").click(function(){
      $("#dv_changepws").dialog("open");
    })
    $("#dv_changepws").dialog({
      autoOpen: false,
      minHeight:200,
      modal: true,
      buttons: {
        "确定": function() {
          if($("#fm_changepws").validationEngine('validate')){
            $.post("changepws.asp",{action:"确定",old_password:$("#old_password").val(),new_password:$("#new_password").val(),confirm_password:$("#confirm_password").val()},function(data){
              if(data){
                alert(data.sInfo);
                if(data.bStatus){
                  if($("#url").val()){
                    location.href=$("#url").val();
                  }else{
                    location.href="index.asp";
                  }
                }
              }
            },"json");
          }
        },
        "取消": function() {
          $(this).dialog( "close" );
        }

      }
    });
    $("#dv_login").dialog({
      autoOpen: false,
      minHeight:200,
      modal: true,
      buttons: {
        "登录": function() {
          $.post("login.asp",{action:"登录",username:$("#login_username").val(),password:$("#login_password").val()},function(data){
            if(data.bStatus){
              if(data.bChangePws){
                alert(data.sInfo);
                location.href="index.asp";
              }else{
                if($("#url").val()){
                  location.href=$("#url").val();
                }else{
                  location.href="index.asp";
                }
              }
            }else{
              alert(data.sInfo);
            }
          },"json");
        },
        "取消": function() {
          $(this).dialog( "close" );
        }

      }
    });
    $("#logout").click(function(){
      $.post("login.asp",{action:"退出"},function(data){
        if(data.bStatus){
          location.href="index.asp";
        }
      },"json");
    });

	});
</script>
